<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>商品咨询列表页  - ${web.name}${web.additionalTitle!}</title>

<link href="${root}/u/css/product.css" type="text/css" rel="stylesheet" />

<link href="${root}/u/css/layout.css" type="text/css" rel="stylesheet" />


<script language="JavaScript" type="text/javascript" src="${root}/u/js/jquery.js"></script>
<script type="text/javascript">
	function insertConsult(pId,sId){
		  var content=$("#content").val();
		  //增加函数，获取选中的radio的值
		  var temp = document.getElementsByName("questionType");
		  for(var i=0;i<temp.length;i++)
		  {
			  if(temp[i].checked)
			     var cType = temp[i].value;
		  }
	        $.post("insertConsult.jspx",{
	            productId:pId,
	            content:content,
	            storeId:sId,
	            consultType:cType
	            },function(data){
	                if(data=='false'){
	                    alert('请先登入！');
	                    var loginForm=getLoginForm();
	                    loginForm.submit();
	               }else if(data=='sameUsually'){
	                   $("#suggestion").html("");
	                 
	                   $("#suggestion").html("<font color='red'>再次发表，请在30秒后发表</font>");
	               }
	               else if(data=='success'){
	            	   $("#content").val("");
	                    alert('成功');
	                    window.location.reload(); 
	               }
	       });
	}
	function getLoginForm(){
	     return document.getElementById("loginForm");
	}
	function getTableForm(){
		     return document.getElementById("tableForm");
	}
	
	function g(o){
		return document.getElementById(o);
	}
	
	function HoverLi(m,n,counter){
		//jQuery
		$(".spms_curr").attr("className","spms_normal");
		$(".dis").attr("className","undis")
		
		//javascript
		g('tb_'+m+n).className='spms_curr';
		g('tbc_'+m+n).className='dis';
		
	}  
</script>
</head>
<style>
	.pl_line { width: 710px; font-size:12px;}
	.pl_zone {color: #000000; display: block; float: left; line-height: 24px; overflow-x: hidden; overflow-y: hidden; word-wrap: break-word; border-bottom: #EAEAEA dotted 1px; padding: 10px 10px 5px 10px; }
	.pl {width: 710px;}
	.pl_zone span {color: #999999;}
	UL, LI {list-style-image: none; list-style-position: outside; list-style-type: none; margin:0; padding: 0;}
	.pl_txt {color: #333333; line-height: 22px;}
	.re_txt {color: #999999;line-height: 18px;margin-top: 5px !important;margin-top: 0;margin-left:0;}
	.re_txt dd span {color: #C90809;}
	.re_txt dd {
	    -moz-border-bottom-colors: none;
	    -moz-border-image: none;
	    -moz-border-left-colors: none;
	    -moz-border-right-colors: none;
	    -moz-border-top-colors: none;
	    border-bottom: #DBDBDB solid 1px;
	    border-left: #C90809 solid 2px;
	    border-right: #DBDBDB solid 1px;
	    border-top: #DBDBDB solid 1px;
	    height: 100%;
	    padding-bottom: 6px;
	    padding-left: 10px;
	    padding-right: 10px;
	    padding-top: 6px;
	    position: relative;
	}
	.re_txt dd div {
	    background-attachment: scroll;
	    background-clip: border-box;
	    background-color: transparent;
	    background-image: url(bg.gif);
	    background-origin: padding-box;
	    background-position: -647px -58px;
	    background-repeat: no-repeat;
	    background-size: auto auto;
	    font-size: 0;
	    height: 8px;
	    left: 12px;
	    line-height: 0;
	    position: absolute;
	    top: -8px;
	    width: 14px;
	}
	.clear/*清除两端*/{clear:both; height:0; overflow:hidden;}
</style>
<body>
	<div class="pl_line ">

	<form id="loginForm" action="${base!}/login.jspx" method="get" target="_top">
	</form>
	<form id="tableForm" action="consultProduct.jspx" method="post">
	     <input type="hidden" value="${product.id!}" name="productId"/>
	</form>
        <table>
			<tr height="38px">
				<td>问题类型：</td>
				<td>
					[#list consultTypes as c]
					<input type="radio" value="${c.value}" name="questionType" [#if c.value='1'] checked="checked" [/#if]>${c.name}</input>
					[/#list]
				</td>
			</tr>
			<tr>
			    <td></td>
			    <td><span id="suggestion"></span></td>
			</tr>
			<tr>
				<td>咨询内容：</td>
				<td>
					<textarea rows="16" cols="60" name="content" id="content" >	
					</textarea>
				</td>
			</tr><br/>
			<tr>
				<td ></td>
			    <td align="center">
				     <input type="button" value="提交" align="middle"
				          onclick="insertConsult('${product.id}','[#if product.store??]${product.store.id}[/#if]');"/> 
			    </td>
			</tr>
         </table>
       <ul class="spxx_type">
              [@consult_count productId=product.id]
                <li class="spms_curr" id="tb_10" onclick="HoverLi(1,0,${consultTypes?size})" style="cursor: hand"><a>全部问答(${consults?size})</a></li>	
              [/@consult_count]
              [#list consultTypes as c] 
                 [@consult_count productId=product.id consultType=c.value]
                   <li class="spms_normal" id="tb_1${c.value}"onclick="HoverLi(1,${c.value},${consultTypes?size})" style="cursor: hand"><a>${c.name}(${consults?size})</a></li>
                 [/@consult_count]
              [/#list]
       </ul>
       
       <div id="tbc_10"  class="dis">
	        <div class="pl_line "> 
			    [@consult_page productId=product.id count='8' pageNo=pageNo ]
			    <ul class="pl_zone" style="width:715px;">
				   [#if tag_list?size gt 0]
				      [#list tag_list as c]
				         <li><strong>${c.member.username!}</strong>&nbsp;&nbsp;<span>[${c.consultTime!}]</span></li>
				         <li class="pl_txt">${c.consult!}</li>
				         [#if c.replay??]
				           <li><dl class="re_txt"><dd><span>${c.store.storeName!}回复：</span>${c.replay}<div></div></dd></dl></li>    
				         [#else]
				           <li>
				              <dl class="re_txt">
				                  <div class="clear"></div>
				              </dl>
				           </li>    
				         [/#if]
				      [/#list]
				    [/#if]  
		        </ul>
		        <div align="center">[@pagination_style sysPage='3'/]</div>
		        <div class="clear"></div>
		        [/@consult_page]
	        </div>
      </div> 
      
      
      [#list consultTypes as s]
      <div class="undis" id="tbc_1${s.value}">
           <div class="pl_line "> 
			    [@consult_page productId=product.id count='8' pageNo=pageNo consultType=s.value]
			    <ul class="pl_zone" style="width:715px;">
				   [#if tag_list?size gt 0]
				      [#list tag_list as c]
				         <li><strong>${c.member.username!}</strong>&nbsp;&nbsp;<span>[${c.consultTime!}]</span></li>
				         <li class="pl_txt">${c.consult!}</li>
				         [#if c.replay??]
				           <li><dl class="re_txt"><dd><span>${c.store.storeName!}回复：</span>${c.replay}<div></div></dd></dl></li>    
				         [#else]
				           <li>
				              <dl class="re_txt">
				                  <div class="clear"></div>
				              </dl>
				           </li>    
				         [/#if]   
				      [/#list]
				    [/#if]  
		        </ul>
		        <div align="center">[@pagination_style sysPage='3'/]</div>
		        <div class="clear"></div>
		        [/@consult_page]
	        </div>
     </div> 
     [/#list]
  <div class="clear"></div>
</div>
      
</body>
</html>
